@{
    ViewBag.Title = "Async";    
}
<script language="javascript" type="text/javascript">
    $(document).ready(function () {

        var bounds = new google.maps.LatLngBounds();
        var options = {
            zoom: 4,
            mapTypeId: google.maps.MapTypeId.TERRAIN,
            position: new google.maps.LatLng(20.58879300000027, -100.38988800000769)
        };
        var googleMap = new google.maps.Map($("#map")[0], options);
        var infoWindow = new google.maps.InfoWindow({ content: "Cargando..." });

        var geocoder;
        var map;
         
        $.ajax({
            type: "POST",
            url: "GetMarkersAsync",
            datatype: "json",
            success: function (data) {
                //alert(JSON.stringify(data));
                if (data.length > 0) {
                    for (var i = 0; i < data.length; i++) {
                        //alert(JSON.parse(toString(data)));
                        var point = new google.maps.LatLng(data[i].Latitude, data[i].Longitude);

                        bounds.extend(point);

                        var marker = new google.maps.Marker({
                            position: point,
                            map: googleMap,
                            html: data[i].InfoWindow
                        });

                        google.maps.event.addListener(marker, "click", function () {                                                        
                            infoWindow.setContent(this.html);
                            infoWindow.open(googleMap, this);
                        });
                    }
                    googleMap.fitBounds(bounds);
                } /*else {
                    initialize();

                    function initialize() {

                        var mapOptions = {
                            zoom: 12,
                            mapTypeId: google.maps.MapTypeId.ROADMAP
                        };
                        map = new google.maps.Map(document.getElementById('map'),
                            mapOptions);

                        // Try HTML5 geolocation
                        if (navigator.geolocation) {
                            navigator.geolocation.getCurrentPosition(function (position) {
                                var pos = new google.maps.LatLng(position.coords.latitude,
                                                                 position.coords.longitude);

                                var infowindow = new google.maps.InfoWindow({
                                    map: map,
                                    position: pos,
                                    content: 'Location found using HTML5.'
                                });

                                map.setCenter(pos);
                            }, function () {
                                handleNoGeolocation(true);
                            });
                        } else {
                            // Browser doesn't support Geolocation
                            handleNoGeolocation(false);
                        }
                    }

                    function handleNoGeolocation(errorFlag) {
                        if (errorFlag) {
                            var content = 'Error: The Geolocation service failed.';
                        } else {
                            var content = 'Error: Your browser doesn\'t support geolocation.';
                        }

                        var mapOptions = {
                            zoom: 4,
                            position: new google.maps.LatLng(20.58879300000027, -100.38988800000769),
                            content: content
                        };

                        var infowindow = new google.maps.InfoWindow(options);
                        map.setCenter(options.position);
                        map.setZoom(options.zoom);
                    }
                }*/


            }

        });

    });
</script>

<h2>
    Async
</h2>
<div id="map" style="width: 800px; height: 500px;">
</div>